#include <bits/stdc++.h>
using namespace std;
int n;
bool isprime(int n) {
  if (n <= 1) return false;
  for (int i = 2; i <= n / i; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  cin >> n;
  while (n--) {
    int a;
    cin >> a;
    cout << (isprime(a) ? "Yes\n" : "No\n");
  }
}

